var orderInfoDao = require('../../dao/orderInfoDao.js');

module.exports = {
    getOrderInfoByMerchantId : getOrderInfoByMerchantId,
    updateOrderInfo : updateOrderInfo
}

function getOrderInfoByMerchantId(req,res,next) {
    let merchantId = req.params.merchantId;
    orderInfoDao.queryOrderInfo({"merchant":merchantId},(err,result)=>{
        if(err){
            console.log("query OrderInfo error !");
        }else{
            res.json(result);
        }
    })
}

function updateOrderInfo(req,res,next) {
    let newOrderInfo = req.body;
    orderInfoDao.updateOrderInfo(newOrderInfo,(err,result)=>{
        if(err){
            console.log("update OrderInfo error !");
        }else{
            res.json(result);
        }
    })
}